package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.VO.ThOrderDetailQueryVo;
import cn.ywsj.ywsjmidtier.entity.VO.WarehouseListQueryVo;
import cn.ywsj.ywsjmidtier.entity.VO.WarehouseListVo;
import cn.ywsj.ywsjmidtier.service.WechatWarehouseListRestFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/wechat/member/warehouselist"})
public class WechatWarehouseListRestController {

    @Autowired
    private WechatWarehouseListRestFeign restFeign;

    @GetMapping(value = {"/getwarehouse"})
    public String getWarehouse() {
       return restFeign.getWarehouse();
    }

    @GetMapping(value = {"/addorderproductoutstock"})
    public String addOrderProductOutStock(ThOrderDetailQueryVo thOrderDetailQueryVo) {
        return restFeign.addOrderProductOutStock(JsonObjectUtil.ObjectToJson(thOrderDetailQueryVo));
    }

    @RequestMapping({"/queryproductbycode"})
    public String queryProductByCode(String code) {
        return restFeign.queryProductByCode(code);
    }

    @PostMapping(value = {"/addproductinstock"})
    public String addProductInStock(WarehouseListVo warehouseListVo, BindingResult result) {
        return restFeign.addProductInStock(JsonObjectUtil.ObjectToJson(warehouseListVo),result);
    }

    @RequestMapping({"/ajaxwarehouselist"})
    public String ajaxWarehouseList(Integer start,Integer pageSize) {
        return restFeign.ajaxWarehouseList(start,pageSize);
    }

    @RequestMapping({"/warehousedetail"})
    public String warehouseDetail(Long wareId) {
        return restFeign.warehouseDetail(wareId);
    }

    @PostMapping(value = {"/addorderdeliveryrecord"})
    public String addOrderDeliveryRecord(WarehouseListVo warehouseListVo, BindingResult result) {
        return restFeign.addOrderDeliveryRecord(JsonObjectUtil.ObjectToJson(warehouseListVo),result);
    }

    @PostMapping(value = {"/orderonceoutstock"})
    public String orderOnceOutStock(WarehouseListVo warehouseListVo) {
        return restFeign.orderOnceOutStock(JsonObjectUtil.ObjectToJson(warehouseListVo));
    }

    @PostMapping(value = {"/sendorderproductoutstock"})
    public String sendorderproductoutstock(WarehouseListVo warehouseListVo, BindingResult result) {
        return restFeign.sendorderproductoutstock(JsonObjectUtil.ObjectToJson(warehouseListVo),result);
    }

    @PostMapping(value = {"/querybatchdeliveryproductstock"})
    public String queryBatchDeliveryProductStock(Long warehouseId, String orderId) {
        return restFeign.queryBatchDeliveryProductStock(warehouseId,orderId);
    }

    @PostMapping(value = {"/addorderbatchdelivery"})
    public String addOrderBatchDelivery(WarehouseListVo warehouseListVo, BindingResult result) {
        return restFeign.addOrderBatchDelivery(JsonObjectUtil.ObjectToJson(warehouseListVo),result);
    }

    @PostMapping(value = {"/batchdeliverylist"})
    public String batchDeliveryList(Integer start,Integer pageSize) {
        return restFeign.batchDeliveryList(start,pageSize);
    }

    @GetMapping(value = {"/batchdeliverydetail"})
    public String batchDeliveryDetail(WarehouseListQueryVo warehouseListQueryVo) {
        return restFeign.batchDeliveryDetail(JsonObjectUtil.ObjectToJson(warehouseListQueryVo));
    }

    @PostMapping(value = {"/receiptorder"})
    public String receiptOrder(WarehouseListVo warehouseListVo) {
        return restFeign.receiptOrder(JsonObjectUtil.ObjectToJson(warehouseListVo));
    }

    @GetMapping(value = {"/sellerdeliverylist"})
    public String sellerDeliveryList(WarehouseListQueryVo warehouseListQueryVo){
        return restFeign.sellerDeliveryList(JsonObjectUtil.ObjectToJson(warehouseListQueryVo));
    }

}
